-
Notifications
You must be signed in to change notification settings - Fork 1
fix request to pay request #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying wildcat-dashboard with
|
| Latest commit: |
fbc5bfa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4a34f516.wildcat-dashboard.pages.dev |
| Branch Preview URL: | https://peanut-requesttopay-1.wildcat-dashboard.pages.dev |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a missing deadline field to the request-to-pay functionality by integrating a Calendar component that allows users to select a payment deadline before submitting a payment request.
Key changes:
- Added a
deadlinefield to theRequestToMintRequesttype definition - Integrated a Calendar component in the "Request to Pay" confirmation drawer to capture the deadline
- Modified the
requestToPayMutationto accept and send the deadline parameter with the API request
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/pages/quotes/QuotePage.tsx | Added state management for deadline date, integrated Calendar component in the ConfirmDrawer, and updated mutation function to accept and pass the deadline to the API |
| src/generated/client/types.gen.ts | Added deadline: string field to the RequestToMintRequest type definition |
Comments suppressed due to low confidence (1)
src/pages/quotes/QuotePage.tsx:329
- The mutation function signature should accept
Date | undefinedto match the type ofrequestToPayDatestate. Additionally, it should validate that the deadline is defined before using it:
mutationFn: async (deadline: Date | undefined) => {
if (!deadline) {
throw new Error("Deadline is required")
}
const { data } = await requestToMint({
body: {
ebill_id: value.bill.id,
amount: value.bill.sum,
deadline: deadline.toISOString()
},
throwOnError: true,
})
return data
}, mutationFn: async (deadline: Date) => {
const { data } = await requestToMint({
body: {
ebill_id: value.bill.id,
amount: value.bill.sum,
deadline: String(deadline)
},
throwOnError: true,
})
return data
},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eab5127 to
9bf54ce
Compare
zupzup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
src/pages/quotes/QuotePage.tsx
Outdated
| const [enableMintingConfirmDrawerOpen, setEnableMintingConfirmDrawerOpen] = useState(false) | ||
| const [requestToPayConfirmDrawerOpen, setRequestToPayConfirmDrawerOpen] = useState(false) | ||
| const [payRequestResponse, setPayRequestResponse] = useState<RequestToMintResponseInfo | null>(null) | ||
| const [requestToPayDate, setRequestToPayDate] = useState<Date | undefined>(addDays(new Date(Date.now()), 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI - the request to pay date has to be at least UTC end_of_day(now() + 48h)
So e.g. if you would do it now (13:05, Tuesday), the minimum TS wouldn't be 13:05 Thursday, but 23:59:59.999_999 Thursday.
So if you want a safe default, 3 days would be better, otherwise you can always calculate the end of day of the selected date.
add missing deadline
9bf54ce to
fbc5bfa
Compare
add missing deadline